package com.qf.controller;

import cn.com.webxml.MobileCodeWS;
import cn.com.webxml.MobileCodeWSSoap;
import com.qf.utils.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 2019/11/29 0029
 * Author->DT
 * qmxc
 * 行到水穷处 坐看云起时
 * 模块：WS 获取手机号码归属地
 */
@Controller
@RequestMapping("/phone")
public class PhoenController {
    @Resource
    private MobileCodeWSSoap mobileCodeWSSoap;
    @RequestMapping("/get-address")
    @ResponseBody
    public ResultVO getAddress(String phone){
        String address = mobileCodeWSSoap.getMobileCodeInfo(phone, null);
        if (address.equals("没有此号码记录")){
            return new ResultVO(0, "没有此号码记录", null);
        }
        String[] strings = address.split("：");
        return new ResultVO(0, strings[1],null);
    }
}
